<template>
  <div class="ver_form_item">
    <p class="label" v-text="label"></p>
    <div class="text_area">
      <input
        :type="type"
        class="input normal-text"
        autocomplete="off"
        :value="value"
        @input="onInput"
        @blur="onBlur"
        @focus="onFocus"
        :placeholder="tip"
      />
      <slot name="icon"></slot>
      <slot name="btn"></slot>
    </div>
    <slot></slot>
  </div>
</template>

<script>
export default {
  name: 'VerticalFormItem',
  props: {
    label: {
      default: '请输入内容'
    },
    type: {
      default: 'text'
    },
    value: {
      default: ''
    },
    inputKey: {
      type: String,
      required: false,
      default: '',
      validator: function (value) {
        return true
      }
    },
    tip: {
      default: ''
    }
  },
  data () {
    return {}
  },
  watch: {},
  methods: {
    onInput: function (e) {
      this.$emit('input', e.target.value)
    },
    onFocus: function () {
      this.$emit('focus')
    },
    onBlur: function () {
      this.$emit('blur')
    },
    iconClickEvent: function () {
      this.$emit('iconClickEvent')
    },
    btnClickEvent: function () {
      this.$emit('btnClickEvent')
    }
  },
  mounted () {
    this.$nextTick(function () {})
  }
}
</script>
<style lang="scss" scoped>
.ver_form_item {
  background: lighgray;
  margin: 20px 0;
  padding: 15px 0;
  .label {
    margin: 10px 0;
    font-size: 28px;
    color: #333333;
  }
  .text_area {
    border-bottom: solid 1px lightgray;
    padding: 10px 0;
    display: flex;
    justify-content: space-between;
    align-items: center;
    .input {
      width: 100%;
      line-height: 50px;
      outline: none;
      border: transparent;
      font-size: 32px;
    }
    .input::-webkit-input-placeholder {
      color: #999;
    }
    .input:-moz-placeholder {
      color: #999;
    }
    .input:-ms-input-placeholder {
      color: #999;
    }
  }
  .icon {
    width: 44px;
    height: 33px;
  }
}
</style>
